package vpfarm;

import java.io.File;
import java.io.IOException;
import java.net.UnknownHostException;

import jtools.files.filesystem.FileOperation;
import jtools.network.mqueue.Adress;
import jtools.network.mqueue.MessageException;

import vpfarm.gui.SlaveGUI;
import vpfarm.slave.Slave;

public class SlaveMain {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		File f = new File(System.getProperty("user.home")+File.separator+".localplattform");
		if (f.exists())
			FileOperation.delete(f, false);
		new SlaveGUI();
	}

	public static void start(String host, int port) {
		File f = new File(System.getProperty("user.home")+File.separator+".localplattform");
		if (f.exists())
			try {
				FileOperation.delete(f, false);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			try {
				Slave s = new Slave(new Adress(host, port));
			} catch (UnknownHostException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (MessageException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
	}

}
